
/*
 * @Descripttion: 客户的跳转
 * @version:
 * @Author: cxguo
 * @Date: 2019-08-16 09:17:57
 * @LastEditors  : cxguo
 * @LastEditTime : 2019-12-30 15:09:25
 */
import { getBillContainGoodsData } from '@/api/bill/bill.js'

export default {
  data() {
    return {}
  },
  methods: {
    initUpdateData() {
      const billId = this.billId
      this.getBillContainGoodsData(billId)
    },
    setOptions(billData) {
      const { supplierId, supplierName } = billData
      this.$set(this.optionsData, 'supplier', [{ id: supplierId, name: supplierName }])
      this.getEmployee()
      this.getAccount()
      // this.$set(this.optionsData, 'account', [{ value: accountId, label: accountName }])
      // this.$set(this.optionsData, 'employee', [{ value: handUserId, label: handUserName }])
    },
    getBillContainGoodsData(billId) {
      getBillContainGoodsData(billId).then(res => {
        if (!res.data.flag) return this.$notify.error({ title: '获取采购单商品失败!' })
        const data = res.data.data
        const { bill, billdetailList } = data
        this.dataObj = bill
        this.setOptions(bill)
        billdetailList.forEach(item => {
          item._sure = true
          item.options = JSON.parse(item.options)
        })
        this.$refs.GoodsSelect.setTableData(billdetailList)
      })
    }
  }
}

